Get premium membership and access questions with answers, video lessons as well as revision papers.

What is wrong with the following fragment? //This program has an error. #include using namespace std; class c11 { int i, j; public: c11 (it a, int b) { i =...

      

What is wrong with the following fragment?
//This program has an error.
#include
using namespace std;
class c11 {
int i, j;
public:
c11 (it a, int b) { i = a; j = b; }
// ...
};
class c12 {
int i; j;
public:
c12 (int a, int b) { i = a; j = b; }
// ...
};
int main()
{
c11 x(1c12 y(0, 0);
x = y;
// ...
}

  

Answers


Davis

The assignment x = y is wrong because c11 and c12 are two different types of classes, and objects of differing class type cannot be assigned.
Githiari answered the question on May 12, 2018 at 17:43


Next: Given the following class, show how an object called ob that passes the value 100 to a and X to c would be declared class sample...
Previous: If a queue dynamically allocates memory to hold the queue, explain the reason for that occurence and state whether in such a situation it...

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions